<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@page import="javax.servlet.jsp.JspWriter"%>
<%@page import="org.emergency.framework.model.contactDeptTree.*"%>
<%@page import="org.emergency.framework.common.Context"%>
<%@page import="org.emergency.framework.action.oa.TbDepartmentAction"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>My JSP starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		
			<jsp:include page="/common/Head.jsp" ></jsp:include>

		<%--
		custom
		--%>
		<link rel="stylesheet" type="text/css"
			href="oa/departmentManage/css/deptTree.css">

		<script type="text/javascript"
			src="oa/departmentManage/js/selectDept.js"></script>


	</head>

	<body>
		<input class='selectDept' type="button" value='选择' />
		<span id = "dept" value="" ></span>



		<!-- 弹出窗口的div -->

		<div class="demo" style="display: none;">

			<!-- 部门选择窗口 -->
			<div id="deptChooseWindow">
				<table width='98%' border='0' width="98%" height="98%"
					cellpadding="3" cellspacing="1" align="center"
					style="background-color: #1177bd">
					<tr>
						<td bgcolor="#ffffff">
							<div id="DeptForm">
								<table width="540" align="center">
									<tbody id="selectArea">
										<tr id='deptArea'>
											<td align="left">
												<span class="span_n">部门</span>
											</td>
										</tr>
										<tr>
											<td>
												<div style="margin-top: 10px">
													<table width="480" align="center">
														<tr>
															<td width="200" align="center">
																<span class="span_n" style="color: #960;">可选部门</span>
															</td>
															<td width="200" align="center">
																<span class="span_n" style="color: #960;">已选部门 </span>
															</td>
														</tr>
														<tr>
															<td width="200" height="200px" align="right"
																style="display: none;">
																<select style="width: 300; height: 180" id="subDepts"
																	name="all" size="6" multiple="multiple">
																</select>
															</td>
														
															<td width="250px" height="350px" id="deptultd2"
																align="center" width="190px" height="180px">
																<div align="left" id="deptuldiv2"
																	style="height: 350px; width: 310px; overflow-y: auto; overflow-x: auto; border: 1px solid #8ACEEC !important">
																	<%!public void printLocalTree(TreeNode node, ServletRequest request,
			ServletResponse response, JspWriter out) throws Exception {
		out.println("<ul><image class= 'unfold' src= 'img/plus.gif' />");
		out.println("<input type='checkbox' value=" + node.getNodeId()
				+ " name=" + node.getName() + " class = 'deptmentcheckbox' />");
		out.println("<span class ='unfold'>"+node.getName()+"</span>");
		List<TreeNode> nodeList = node.getChildren();
		for (int i = 0; i < nodeList.size(); i++) {
			out.println("<li>");
			printLocalTree(nodeList.get(i), request, response, out);
			out.println("</li>");
		}
		out.println("</ul>");
	}%>

																	<%
																		EmergencyTree emergencyTree = ((TbDepartmentAction) Context.webApplicationContext
																																			.getBean("tbDepartmentAction")).getEmergencyTree();

																																	TreeNode node = emergencyTree.getRootNode();
																																	printLocalTree(node, request, response, out);
																	%>																
																</div>
															</td>
															<!-- czy,end -->

															<td width="250px" height="350px" align="left">
																<select style="width: 190px; height: 350px"
																	id="selDepts" name="sel" size="6" multiple="single">
																</select>
															</td>


														</tr>
													</table>
												</div>
											</td>
											<td></td>
										</tr>
									</tbody>
									<tr class="trtab">
										<td align="center" colspan="2">
											<button id="selDeptOK" class="submit">
												确定
											</button>
											<span style="padding-left: 20">
												<button id="selDeptCancel" class="submit">
													取消
												</button> </span>
										</td>
									</tr>
								</table>
							</div>
						</td>
					</tr>
				</table>
			</div>
			<div id="dialog-message" title="操作结果" style="display: none">
				<div id="message" style="padding-top: 15">
				</div>
			</div>
		</div>
		<!-- 弹出窗口的end -->
	</body>



</html>